# -*- coding: utf-8 -*-
"""
Created on Sat Nov 11 22:31:40 2017
创建并行版本
@author:YYl
"""


from sqlalchemy import create_engine
import tushare as ts

engine = create_engine('sqlite:///foo.db')

basics=ts.get_stock_basics()

for j,i in enumerate(basics.index):
    print('第%d个股票，股票代码%s' % (j+1,i))
    df=ts.get_k_data(i, ktype='D', autype='qfq',start='2000-1-01')
    df.to_sql(i,engine,if_exists='append')
    
#追加数据到现有表
#df.to_sql('tick_data',engine,if_exists='append')
    
#mpi4py  
    
    